package lt.marsrutai.mobile.android.handler.menu;

import lt.marsrutai.mobile.android.R;
import lt.marsrutai.mobile.android.activity.intent.FastestRoutesSearchIntentHolder;
import lt.marsrutai.mobile.android.activity.intent.SchedulesIntentHolder;
import android.app.Activity;
import android.content.Intent;

import com.actionbarsherlock.view.MenuItem;

public class SchedulesMenuHandler extends StandartMenuHandler {

    @Override
    public Intent handle(MenuItem item, Activity activity) {
        SchedulesIntentHolder sourceIntentHolder = new SchedulesIntentHolder(activity.getIntent());

        switch (item.getItemId()) {
        case R.id.fastest_routes:
            FastestRoutesSearchIntentHolder fastestRoutesSearchIntentHolder = new FastestRoutesSearchIntentHolder(activity);
            fastestRoutesSearchIntentHolder.setScopeFolder(sourceIntentHolder.getScopeFolder());
            return fastestRoutesSearchIntentHolder.getIntent();
        case R.id.stop_search:
            activity.onSearchRequested();
            return null;
        default:
            return super.handle(item, activity);
        }

    }
}
